package cn.bocweb.spinning.view.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.bigkoo.convenientbanner.holder.Holder;
import com.bumptech.glide.Glide;
import com.squareup.picasso.Picasso;

import cn.bocweb.spinning.R;

/**
 * Created by chenchangxing on 16/1/22.
 */
public class BannerAdapter implements Holder<String> {
    ImageView imageView;
    @Override
    public View createView(Context context) {
        imageView = new ImageView(context);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setImageResource(R.mipmap.banner_empty);
        return imageView;
    }

    @Override
    public void UpdateUI(Context context, int position, String data) {
        Picasso
                .with(context)
                .load(data)
                .placeholder(R.mipmap.banner_empty)
                .error(R.mipmap.banner_empty)
                .fit()
                .into(imageView);
    }
}
